home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
tdk_v120.zip
/
_SIO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-07-15
|
4KB
|
113 lines
{
▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀ ▀▀ ▀▀
▀▀ ▀▀ ▀▀ ▀▀ ▀▀
▀▀ ▀▀ ▀▀▀ ▀▀▀▀▀ The DoorKit!
▀▀ ▀▀ ▀▀ ▀▀ ▀▀
▀▀ ▀▀▀▀▀▀ ▀▀ ▀▀
The BBS Door Development Kit By The People - For The People!
Feel free to modify or optimize this code at will. All I ask is that if
find a better way to do things (and you will), please send me a copy of
your modifications. Thanks in advance!....Larry L. Athey....}
UNIT _SIO;
{ Including this unit in your main program source code allows you to use
TP's "write" & "writeln" procedures to do any output. It will output to
the remote and the local sides, just like if you were using the included
output routines in The DoorKit unit! The only limitation in this method
is that you can't put color/animation codes in the string, if you do they
will be displayed on both screens as normal text, you have to change the
colors by using the Set_Color, SetFore, or SetBack procedures.
The syntax for using this method is:
WRITE(SIO,'This is string 1.',' This is another...', ' A number:',12);
^^^
^^^-> The SIO file is the important element to use this method.
You basically use the SIO variable just like if it were an actual text
file. But certain procedures like "close,append,reset,rewrite,etc" don't
do anything when called with SIO. (Rewrite actually DOES do something,
but its handled automatically by this unit, and once Rewrite is called
once, successive calls don't do anything more). The SIO file does not
need to be closed, TP will do that on its own when the program exits.
Do NOT try to use READLN() with the SIO variable, it'll do NOTHING, and
you'll get unpredicted results from it.}
INTERFACE
USES CRT, DOS, DOORKIT1;
VAR
IOBuf : ARRAY[0..511] OF CHAR;
SIO : TEXT;
IMPLEMENTATION
{───────────────────────────────────────────────────────────────────────────}
FUNCTION IOnothing(VAR F : TextRec) : INTEGER; Far;
BEGIN
IOnothing := 0;
END;
{───────────────────────────────────────────────────────────────────────────}
FUNCTION IOinput(VAR F : TextRec) : INTEGER; Far;
BEGIN
IOinput := 0;
END;
{───────────────────────────────────────────────────────────────────────────}
FUNCTION IOoutput(VAR F : TextRec) : INTEGER; Far;
VAR
I : WORD;
BEGIN
WITH F DO BEGIN
I := 0;
WHILE I < BufPos DO BEGIN
sWriteC(BufPtr^[I]);
INC(I);
END;
BufPos := 0;
END;
IOoutput := 0;
END;
{───────────────────────────────────────────────────────────────────────────}
FUNCTION IOclose(VAR F : TextRec) : INTEGER; Far;
BEGIN
IOclose := 0;
END;
{───────────────────────────────────────────────────────────────────────────}
FUNCTION IOopen(VAR F : TextRec) : INTEGER; far;
BEGIN
WITH F DO BEGIN
IF Mode = FMinput THEN BEGIN
InOutFunc := @IOnothing;
FlushFunc := @IOnothing;
END ELSE BEGIN
Mode := FMoutput;
InOutFunc := @IOoutput;
FlushFunc := @IOoutput;
END;
CloseFunc := @IOnothing;
END;
IOopen := 0;
END;
{───────────────────────────────────────────────────────────────────────────}
PROCEDURE AssignIO;
BEGIN
FILLCHAR(SIO, SIZEOF(SIO), 0);
WITH TextRec(SIO) DO BEGIN
Handle := $FFFF;
Mode := FMclosed;
BufSize := SIZEOF(Buffer);
BufPtr := @Buffer;
OpenFunc := @IOopen;
END;
END;
{───────────────────────────────────────────────────────────────────────────}
BEGIN
AssignIO;
SETTEXTBUF(SIO,IOBuf);
REWRITE(SIO);
END.